<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点击穿透</title>
    <style>
        a{
            display:block;
        }
        #banner{
            width: 100%;
            height: 400px;
            background:#cea;
        }

        .mask{
            box-sizing: border-box;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            position:absolute;
            left: 0;
            top:0;
            padding: 100px 0 0 100px;
            z-index: 100;
        }
    </style>
</head>
<body>
    <a href="http://www.atguigu.com"><div id="banner"></div></a>

    <div class="mask">
        <button>点击关闭</button>
    </div>

    <script>
        //获取元素
        let btn = document.querySelector('button');
        let mask = document.querySelector('.mask');

        btn.addEventListener('touchstart', function(){
            //关闭遮罩
            mask.style.display = 'none';
        });

        //父级元素绑定触摸事件   『冒泡』
        // mask.addEventListener('touchstart', function(e){
        //     e.preventDefault();
        // })

        document.documentElement.addEventListener('touchstart', function(e){
            e.preventDefault();
        }, {
            passive: false
        });
    </script>
</body>
</html>